package com.xhj.xmly.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.xhj.xmly.R;
import com.xhj.xmly.activity.MainActivity;

/**
 * Created by XHJ on 2016/12/2.
 */
public class MineFragment extends Fragment implements View.OnClickListener {
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        return inflater.inflate(R.layout.mine_fragment,container,false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ImageView imageView = (ImageView) view.findViewById(R.id.iv_head);
        Button button = (Button) view.findViewById(R.id.record);
        RelativeLayout hoster_manager = (RelativeLayout) view.findViewById(R.id.hoster_manager);
        RelativeLayout message = (RelativeLayout) view.findViewById(R.id.message);
        RelativeLayout sound_bought = (RelativeLayout) view.findViewById(R.id.sound_bought);
        RelativeLayout balance = (RelativeLayout) view.findViewById(R.id.balance);
        RelativeLayout my_subscription = (RelativeLayout) view.findViewById(R.id.my_subscription);
        RelativeLayout play_histoury = (RelativeLayout) view.findViewById(R.id.play_histoury);
        RelativeLayout my_grade = (RelativeLayout) view.findViewById(R.id.my_grade);
        RelativeLayout praised = (RelativeLayout) view.findViewById(R.id.praised);
        RelativeLayout shop = (RelativeLayout) view.findViewById(R.id.shop);
        RelativeLayout order = (RelativeLayout) view.findViewById(R.id.order);
        imageView.setOnClickListener(this);
        button.setOnClickListener(this);
        hoster_manager.setOnClickListener(this);
        message.setOnClickListener(this);
        sound_bought.setOnClickListener(this);
        balance.setOnClickListener(this);
        my_subscription.setOnClickListener(this);
        play_histoury.setOnClickListener(this);
        my_grade.setOnClickListener(this);
        praised.setOnClickListener(this);
        shop.setOnClickListener(this);
        order.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        MainActivity activity = (MainActivity) getActivity();
        DrawerLayout drawerLayout_main = activity.getDrawerLayout_main();
        FrameLayout fram_main = activity.getFram_main();
        drawerLayout_main.openDrawer(fram_main,true);
    }
}
